/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2024 All Rights Reserved.
 */
package com.alipay.demo.controller;

import com.alipay.demo.service.LocalItemCalendarService;
import com.alipay.demo.vo.LocalItemSpuRequest;
import com.alipay.demo.vo.OpenResponse;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author jishupei.jsp
 * @version : LocalItemCalendarController, v0.1 2024年05月23日 11:29 上午 jishupei.jsp Exp $
 */
@Api(tags = "本地商品酒店日历房模块")
@ApiSupport(order = 3)
@RestController
@RequestMapping(value = "/localitem/calendar")
public class LocalItemCalendarController {

    @Autowired
    private LocalItemCalendarService localItemCalendarService;

    /**
     * 本地商品SPU保存
     */
    @ApiOperation(value = "本地商品SPU保存")
    @ApiOperationSupport(order = 1)
    @PostMapping(value = "/spu/save")
    public OpenResponse<String> saveSpu(@RequestBody LocalItemSpuRequest request) {
        return localItemCalendarService.saveSpu(request);
    }

    /**
     * 本地商品日历库存保存
     */
    @ApiOperation(value = "本地商品日历库存保存")
    @ApiOperationSupport(order = 2)
    @GetMapping(value = "/stock/save")
    public OpenResponse<Void> saveCalendarStock(@ApiParam(value = "支付宝侧商品id") @RequestParam(required = false) String itemId,
                                                @ApiParam(value = "商家侧商品id") @RequestParam(required = false) String outItemId,
                                                @ApiParam(value = "库存的状态，1:有效/0:删除，默认1") @RequestParam Long status) {
        return localItemCalendarService.saveCalendarStock(itemId, outItemId, status);
    }

    /**
     * 本地商品日历价格保存
     */
    @ApiOperation(value = "本地商品日历价格保存")
    @ApiOperationSupport(order = 3)
    @GetMapping(value = "/price/save")
    public OpenResponse<Void> saveCalendarPrice(@ApiParam(value = "支付宝侧商品id") @RequestParam(required = false) String itemId,
                                                @ApiParam(value = "商家侧商品id") @RequestParam(required = false) String outItemId,
                                                @ApiParam(value = "价格的状态，1:有效/0:删除，默认1") @RequestParam Long status) {
        return localItemCalendarService.saveCalendarPrice(itemId, outItemId, status);
    }
}
